/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package metricmaster.gui.actualtab;

import javax.swing.table.AbstractTableModel;
import metricmaster.gui.AppData;
import metricmaster.model.Activity;
import metricmaster.model.Project;

/**
 *
 * @author markblanda
 */
public class ActualTableModel extends AbstractTableModel {
    private Project project = AppData.getInstance().getProject();
    private String[] columnNames;
    
    //private String[] columnNames = {"Date", "Shop Order 1", "Shop Order 2", "Shop Order 3"};
    
    Object[][] data;
//            = {
//        {"1-Oct-13", "3", "4", "6"},
//        {"8-Oct-13", "3", "5", "6"},
//        {"8-Oct-13", "3", "5", "6"}
//    };
    
    public ActualTableModel() {
        data = new Object[52][project.getProjectActivities().size()+1];
        columnNames = new String[project.getProjectActivities().size() + 1];

        data[0][0] = "Week";
        //loop through all activities
        for (int j=0; j < project.getProjectActivities().size(); j++) {
            Activity act = project.getProjectActivities().get(j);
            //loop through all weeks of planned data
            data[0][j+1] = act.getShopOrder();
            for (int i=1; i < project.getWeeks(); i++) {
                //data[i+1][j] = act.getPlannedHours().get(i);
                data[i][j] = 0.0;
            }
        }
    }
    
    
    @Override
    public String getColumnName(int columnIndex) {
        return columnNames[columnIndex];
    }
    
    @Override
    public int getRowCount() {
        return data.length;
    }

    @Override
    public int getColumnCount() {
        return columnNames.length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return data[rowIndex][columnIndex];
    }
    
}
